package com.sxs.tools.logcat;

import android.app.Activity;
import android.content.Intent;
import android.view.Gravity;
import android.view.View;

import com.sxs.tools.R;
import com.sxs.tools.toastx.OnClickListener;
import com.sxs.tools.toastx.XToast;
import com.sxs.tools.toastx.draggable.SpringDraggable;

/**
 * @author sxs
 * @date :2020/8/21
 * @description: 悬浮窗口
 */
final class FloatingWindow extends XToast implements OnClickListener {

    FloatingWindow(Activity activity) {
        super(activity);
        setView(R.layout.logcat_window_floating);
        setAnimStyle(android.R.style.Animation_Toast);
        setDraggable(new SpringDraggable());
        setGravity(Gravity.END | Gravity.CENTER_VERTICAL);
        setOnClickListener(android.R.id.icon, this);
    }

    @Override
    public void onClick(XToast toast, View view) {
        startActivity(new Intent(getContext(), LogcatActivity.class));
    }
}